<!--#include file="../nav/top.php" -->
<!--#include file="../nav_menu/user_begin.php" -->

		<div class="inbox">
			<div class="inbox_title">
				配送历史查询
			</div>
			<div class="inbox_content">
				  
					
				<div style="margin:15px auto">
					搜索：
					<select id="senddate" class="textBox"  onChange="fnSearchDate()" style="margin-right:5px;">
						<option value="0" selected="selected">--所有配送日期--</option>
						<option value="2">本周</option> 
						<option value="3">本月</option> 
						<option value="4">本季度</option> 
						<option value="5">本年度</option> 
						<option value="">自定义时间段</option> 
					</select>
					<span id="s_date_div" style="display:none;margin:5px auto;">
						从
						<input type="text" class="textBoxDate" id="b_date" value="" readonly="readonly" maxlength="10" />
						<input id="b_date_slt" class="btnicon_calendar" type="button">
						到
						<input type="text" class="textBoxDate" id="e_date" value="" readonly="readonly" maxlength="10" />
						<input id="e_date_slt" class="btnicon_calendar" type="button">
					</span>	
					
					<span style="margin-left:20px;">
					 <input type="hidden" maxlength="12" id="keywords" class="searchs" />
						<input type="button"  onclick="fnSearchs()" value="查询"  />  	
					</span>	
				</div> 
				<div id="grids"></div> 	
					
					
			</div>			
		</div>
		

<script type="text/javascript">
var url_list = '/user/send'; 


$().ready(function(){
	o2js.build('ymprompt'); 

	o2js.build('jscalendar');
	o2js.build('dates');
	fnSetSltDate('b_date','b_date_slt')
	fnSetSltDate('e_date','e_date_slt')
	$('#b_date').val(getWeekFirst(new Date()).eformat('yyyy-MM-dd'));
	$('#e_date').val(getWeekLast(new Date()).eformat('yyyy-MM-dd'));
	$('#b_date').val('');
	$('#e_date').val('');


	o2js.build('jquery_cluetip');
	o2js.build('o2grid');
	showLoading();
	grids = new o2Grid({
		bind:'grids', 
		url:url_list,
		imgpath:'/misc/vendors/o2js/o2grid/image',
		cols:[
			{index:'id',mapping:'a.id', name:'序号', width:35,sortable:false, func:function(val,row_index,column_name,json,R){
				 return  '<span title="ID：'+json.id+'" >'+((R.page - 1)*R.rowNum + (row_index+1))+'</span>';
			}}, 
			{index:'senddate',mapping:'b.senddate', name:'配送日期', width:100 
			},
			{index:'packet',mapping:'a.packet', name:'配送菜品', width:700 ,func:function(val,row_index,column_name,json,R){
				return json.veges_html;
			}
			}
		]
	});
	fnSearchs();	 
	$('#keywords').keypress(function(e){
		if(e.keyCode==13||e.keyCode==10){
			fnSearchs();
		}
	}); 
	
});
function fnSearchs(){
	grids.setBaseParams({
		keywords:encodeURIComponent($('#keywords').val()),
		b_date:$('#b_date').val(),
		e_date:$('#e_date').val()
	}); 
	grids.load(1); 
}

/* 预定义日期 */
function fnSearchDate(){
	$('#s_date_div').show();
	var date = new Date();
	switch($('#senddate').val()){
		case "0"://  
			$('#b_date').val('');
			$('#e_date').val('');
			break;
		case "1"://  
			$('#b_date').val(today());
			$('#e_date').val(today());
			break;
		case "2":// 
			var b = getWeekFirst(date).eformat('yyyy-MM-dd');
			var e = getWeekLast(date).eformat('yyyy-MM-dd'); 
			$('#b_date').val(b);
			$('#e_date').val(e);
			break;
		case "3"://本月
			var b = getMonthFirst(date).eformat('yyyy-MM-dd');
			var e = getMonthLast(date).eformat('yyyy-MM-dd'); 
			$('#b_date').val(b);
			$('#e_date').val(e);
			break;
		case "4"://本季度
			var b = getQuarterFirst(date).eformat('yyyy-MM-dd');
			var e = getQuarterLast(date).eformat('yyyy-MM-dd'); 
			$('#b_date').val(b);
			$('#e_date').val(e);
			break;
		case "5"://本年度
			var b = getYearFirst(date).eformat('yyyy-MM-dd');
			var e = getYearLast(date).eformat('yyyy-MM-dd'); 
			$('#b_date').val(b);
			$('#e_date').val(e);
			break;
		default:
			$('#s_date_div').show();
			break;
	}
}
 
</script>	 	


<!--#include file="../nav_menu/user_end.php" -->
<!--#include file="../nav/bottom.php" -->